"use client"
import React, { useEffect } from 'react'
import { useRouter } from 'next/navigation'; // 如果是Next.js项目


export default function yztoken(Com) {
    return function Token(props) {
const router = useRouter(); // Next.js使用useRouter
        useEffect(() => {
            let token = localStorage.getItem('token')
            if (!token) {
                router.push('/login')
            }
        })
        return (
            <div>
                <Com {...props} />
            </div>
        )
    }
}
